@extends('web.master')
@section('title','抽奖记录')
@section('head')
    <link rel="stylesheet" href="{{asset('statics/css/index20180307.css')}}" />
@endsection
        @section('content')
            <div class="tab_prize">
                <a href="{{route('user_prizes',['isExchange'=>0])}}"  @if($isExchange==0) class="active" @endif>未兑换</a>
                <a href="{{route('user_prizes',['isExchange'=>1])}}" @if($isExchange==1) class="active" @endif >已兑换</a>
            </div>
            <div class="contBox">
                @if(count($memberPrize)>0)
                    @foreach($memberPrize as $k=>$v)
                <div class="listCont prize">
                    <div class="content">
                        <div class="pic">
                            <div class="img" style="background: url('{{asset('storage/'.$v->image)}}') no-repeat center;  background-size: cover;"></div>
                            <div class="prize_tip">
                                @if($isExchange==1)<img src="{{asset('statics/images/code_ydh.png')}}"/>@else
                                    <a href="javascript:void(0)" onclick="showQrcode({{$v->id}})" >
                                        <img src="{{asset('statics/images/code_wdh.png')}}"/>
                                        <input type="hidden" id="qrcode{{$v->id}}" value="{{asset('storage/'.$v->qrcode)}}">
                                    @endif</a>
                            </div>
                        </div>
                        <div class="title">{{$v->prize_name}}</div>
                    </div>
                </div>
                    @endforeach
                    @else
                    <div class="null">
                        <img src="{{asset('/statics/images/null.png')}}" />
                    </div>
                    @endif
                    <div class="mask_prize" style="display: none" onclick="hideRrcode()">
                        <div class="prize_box">
                            <img src="" class="code_img"/>
                            <p>请景区服务中心扫码兑换</p>
                            <img src="{{asset('/statics/images/Water.png')}}" class="water"/>
                        </div>
                    </div>
                    <script type="text/javascript" src="{{'/statics/js/jquery.min.js'}}" ></script>
</div>
    <script>
        function showQrcode(prize_id) {
            var qrcode=$("#qrcode"+prize_id).val();
            $(".code_img").attr("src",qrcode);
            $(".mask_prize").show();
        }
        function hideRrcode(){
            $(".mask_prize").hide();
        }

    </script>
        @endsection